package com.li.jiang.obj.vo;


import com.li.jiang.obj.pojo.Photos;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("图片vo")
public class PhotosVo {
    private String url;
    private String name;
    private Long id;

    public static PhotosVo of(Photos p){
        return new PhotosVo(p.getHref(),p.getName(), p.getId());
    }
    public static List<PhotosVo> of(List<Photos> list){
        List<PhotosVo> vos = new ArrayList<>(list.size());
        for (Photos p :list){
            vos.add(of(p));
        }
        return vos;
    }
}
